<template>
  <div>
    <button @click="min">-</button>
    <span>购物车</span>
    <button @click="add">+</button>
  </div>
</template>
<script>
import {useStore} from 'vuex'
export default{
  name: 'Cart',
  setup(){
    const store = useStore()
    const add = () => {
      store.dispatch('add', 1)
    }
    const min = () => {
      store.dispatch('min', 1)
    }
    return {add, min}
  }
}
</script>